Changes the current drive.
現在のドライブを変更します。
ChDrive Text As String
ChDrive Text As String
Text: Any string expression that contains the drive letter of the new drive. If you want, you can use URL notation.
Text: 変更後のドライブレターを指定する文字列表式。必要であれば、URL 指定を用いることもできます。
The drive must be assigned a capital letter. Under Windows, the letter that you assign the drive is restricted by the settings in LASTDRV. If the drive argument is a multiple-character string, only the first letter is relevant. If you attempt to access a non-existent drive, an error occurs that you can respond to with the OnError statement.
ドライブは、大文字で指定する必要があります。Windows 環境の場合、ドライブレターに使える文字は、LASTDRV の設定による制限を受けます。ドライブ指定の引数に複数の文字を渡した場合は、最初の文字のみが有効になります。存在しないドライブにアクセスを試みるとエラーが発生しますが、その場合は OnError ステートメントで対処できます。
Sub ExampleCHDrive
Sub ExampleCHDrive
ChDrive "D" REM Only possible if a drive 'D' exists.
ChDrive "D" REM ドライブ「D」が存在する場合にのみ有効
End Sub
End Sub